var XHR = {
	xhr: new XMLHttpRequest(),

	get: function(url, callback) {
		/* Setup request */
		this.xhr.open('GET', url, true);

		/* Setup callback */
		if (callback) {
			this.xhr.onreadystatechange = function() {
				if (this.readyState == 4)
					callback(this.responseText);
			};
		}

		/* Send request */
		this.xhr.send();
	},

	post: function(url, params, callback) {
		/* Setup request */
		this.xhr.open('POST', url, true);
		this.xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');

		/* Setup callback */
		if (callback) {
			this.xhr.onreadystatechange = function() {
				if (this.readyState == 4)
					callback(this.responseText);
			};
		}

		/* Send request */
		this.xhr.send(params);
	}
};
